package com.greatchn.authorization_server.web.po;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.io.Serializable;
import java.util.Objects;

/**
 * @OauthRoleGroupInfoPK:
 * @author: ZBoHang
 * @time: 2023/2/28 9:07
 */
public class OauthRoleGroupInfoPK implements Serializable {
    private Integer roleGroupId;
    private Integer belongToUserGroupId;

    @Column(name = "role_group_id", nullable = false)
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer getRoleGroupId() {
        return roleGroupId;
    }

    public void setRoleGroupId(Integer roleGroupId) {
        this.roleGroupId = roleGroupId;
    }

    @Column(name = "belong_to_user_group_id", nullable = false)
    @Id
    public Integer getBelongToUserGroupId() {
        return belongToUserGroupId;
    }

    public void setBelongToUserGroupId(Integer belongToUserGroupId) {
        this.belongToUserGroupId = belongToUserGroupId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        OauthRoleGroupInfoPK that = (OauthRoleGroupInfoPK) o;
        return Objects.equals(roleGroupId, that.roleGroupId) && Objects.equals(belongToUserGroupId, that.belongToUserGroupId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(roleGroupId, belongToUserGroupId);
    }
}
